<?php
/**
 * @author ran
 */
namespace common\helper;

class StringHelper extends \yii\helpers\StringHelper
{
    
    /**
     * 截取字符串，超出长度，出现...
     * @param string $text
     * @param int $length
     * @return string|unknown
     */
    public static  function  subtext($text, $length)
    {
        if(mb_strlen($text, 'utf8') > $length) {
            return mb_substr($text, 0, $length, 'utf8').'...';
        }
        
        return $text;
    }
    
}

?>